/**
 * 
 */
package t4j.generics;

import java.util.ArrayList;
import java.util.List;

/**
 * @author sz
 *
 * create time：2013-1-17
 */
public class GenericsAndCovariance {

	public static void main(String[] args) {
		
		//Type mismatch: cannot convert from ArrayList<Apple> to List<Fruit>
		//List<Fruit> first = new ArrayList<Apple>();
		List<? extends Fruit> first = new ArrayList<Apple>();
		//编译错误
		//first.add(new Apple());
		//first.add(new Frult());
		//first.add(new Object());
		
		first.add(null);
		
		Fruit f = first.get(0);
	}
}
